//
//  HOTBaseViewController.h
//  Genpara
//
//  Created by AndyChang.zhang on 14-8-27.
//  Copyright (c) 2014年 zhangchh. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "HOTCommBtn.h"
#import "HOTHttpClient.h"
#import "MBProgressHUDManager.h"
#import "HOTUserInfo.h"
#import "HOTCommChatBar.h"
#import "RMStore.h"

typedef enum {
    
    HOTTitleFont_DEFAULT = 0,
    HOTTitleFont_ROUNDED_X,
    HOTTitleFont_HELVETICA_NEUE,
    HOTTitleFont_HIRAGINO_KAKU_W3,
    HOTTitleFont_HIRAGINO_KAKU_W6,
    
} HOTTitleFontSytle;

typedef enum {
    
    HOTNaviBarRightBtnDone = 0,
    HOTNaviBarRightBtnEdit
    
} HOTNaviBarRightBtnType;

typedef enum {
    
    HOTInputItemText = 0,
    HOTInputItemPullDown = 1,
    
} HOTInputItemType;

typedef enum {
    
    HOTCharBarStyleForReplay = 0, //回复bar 不包括表情
    HOTCharBarStyleForReplayWithEmjo, //回复bar 包括表情
    HOTCharBarStyleForImageOnly, //只带发送图片的bar
    HOTCharBarStyleForImageProject    //包括发送图片和发注书的bar
    
}HOTCharBarStyle;

@interface HOTBaseViewController : UIViewController {
    
    HOTHttpClient *_httpClient;
    MBProgressHUDManager *_hudManager;
    HOTUserInfo *_userInfo;
    BOOL _isShowHud;
}


-(void)setNaviTitle:(NSString *)title
           fontSize:(float)fontSize
           fontName:(HOTTitleFontSytle)titleFontStyle;

-(void)setNaviTitle:(NSString *)title;

-(void)setNavBarHidden:(BOOL)flg;
-(void)backBtnClicked:(id)sender;
-(void)createRightBtnWithType:(HOTNaviBarRightBtnType) rightBtnStyle;
-(void)addRightBtnTarget:(id)target
                  action:(SEL)selector
                   image:(UIImage *)btnImage
                  hImage:(UIImage *)hImage;

-(UIBarButtonItem *)createBarButtomItemTarget:(id)target
                                       action:(SEL)selector
                                        image:(UIImage *)btnImage
                                       hImage:(UIImage *)hImage
                                   edgeInsets:(UIEdgeInsets)edgeInsets;


//-(void)requestWithURL:(NSString *)urlString
//           Parameters:(id)parameters
//              success:(void (^)(id responseObject))success
//              failure:(void (^)(NSError *error,NSString *errMsg))failure;

-(void)requestWithURL:(NSString *)urlString
           Parameters:(id)parameters
              success:(void (^)(NSInteger result, id data))success
              failure:(void (^)(NSError *error, NSString *errMsg))failure;

-(void)requestGetWithURL:(NSString *)urlString
              Parameters:(id)parameters
                 success:(void (^)(id data))success
                 failure:(void (^)(NSError *error, NSString *errMsg))failure;

-(void)uploadImageWithPost:(NSString *)urlString
                 imageData:(NSData *)imageData
                uploadName:(NSString *)uploadName
                Parameters:(id)parameters
                   success:(void (^)(id data))success
                   failure:(void (^)(NSError *error, NSString *errMsg))failure;

-(void)afterPopWithViewController:(UIViewController *)vc;
-(NSString *)getErrMsgWith:(NSString *)itemName itemType:(HOTInputItemType)itemType;

-(void)rightBtnClicked:(HOTCommBtn *)sender;
-(void)showLoading;
-(void)loadingSuccess;
-(void)showLoadingWithMessage:(NSString *)msg;
-(void)showSuccessWithMessage:(NSString *)msg complection:(void (^)())completion;
-(void)showSuccessWithMessage:(NSString *)msg;
-(void)showChatInputBar:(BOOL)showFlg;
-(void)showChatInputBar:(BOOL)showFlg withStyle:(HOTCharBarStyle)barStyle;
-(void)chatBarFrameWillChange:(CGPoint)newPoint;
/**
 *  弹出提示没有更多数据
 */
-(void)alertNoDataAgainMessage:(void (^)(void))action;
/**
 *  弹出提示没有数据
 */
-(void)alertNoDataMessage:(void (^)(void))action;

@property (strong, nonatomic) HOTCommChatBar *chatInputBar;
//@property (weak, nonatomic) IBOutlet UITextView *chatTextView;
@property(nonatomic,readonly)HOTHttpClient *httpClient;
@property(nonatomic,readonly)MBProgressHUDManager *hudManager;
@property(nonatomic,readonly)HOTUserInfo *userInfo;
@property(nonatomic,readonly)BOOL isShowHud;
@property(nonatomic,readonly)RMStore *storeHandler;
@property(nonatomic)BOOL popVcExcute;//true 表示前一个vc会在pop动画之后执行【afterPopWithViewController】方法中得代码
@property(nonatomic,assign)CGRect keyBoardFrame;
@property(nonatomic,readonly)HOTConfig *config;
//用新的view初始化hud的方法
-(void)initHudWithView:(UIView *)view;
-(BOOL)checkErrResult:(NSError *)error errMsg:(NSString *)errMsg;

//overwrite
-(void)popupView:(ZZZPopupView *)popupView buttonKind:(ZZZPopupViewBtnKind)btnKind;

@end
